home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_069 / console / constest.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  1KB  |  69 lines

  1. #define printf myprintf
  2. #define getchar mygetc
  3. #define putchar myputc
  4. #define puts myputs
  5. #define exit myexit
  6. #define scanf myscanf
  7. #define gets mygets
  8.  
  9. extern char FillFlag;
  10.  
  11. void PressAKey();
  12.  
  13. char WindowTitle[] = "Test Window for Console Routines";
  14.  
  15. main()
  16. {
  17.     int x1,x2,y1;
  18.  
  19.     puts("How about a try for 'scanf'.");
  20.     puts("Enter some regular ASCII, and then a number.");
  21.     printf("Input ==> \x9bn");
  22.     scanf("%s%d",(char *) x1, &x2);
  23.     printf("\nThe string is: %s\nThe number is: %d\n\n",x1,x2);
  24.  
  25.     puts("Now a test of 'gets'.");
  26.     printf("==> ");
  27.     x1 = gets();
  28.     puts("You entered the following line:");
  29.     puts(x1);
  30.     printf("%d character%c long.\n\n",
  31.         (strlen(x1)),(strlen(x1)==1) ? '\0':'s');
  32.  
  33.     PressAKey();
  34.  
  35.     printf("%cOkay.  First we'll start with some lines.\n\n",0x0C);
  36.  
  37.     for(x1=300,x2=100,y1=0;y1++<20;x1-=10,x2+=4)
  38.         Line(639,199,x1,x2,1);
  39.  
  40.     puts("And now a box or two.\n");
  41.  
  42.     Box(400,50,600,150,2);
  43.  
  44.     FillFlag = 1;            /* fill in the next one */
  45.  
  46.     Box(450,70,550,130,2);
  47.  
  48.     FillFlag = 0;            /* Turn off filling again */
  49.  
  50.     puts("A Pair of Circles.\n");
  51.  
  52.     Circle(500,40,30,3);
  53.     Circle(500,40,10,3);
  54.  
  55.     PressAKey();
  56.  
  57.     exit(0);
  58. }
  59.  
  60. void PressAKey()
  61. {
  62.     puts("Now, wasn't that fun?");
  63.  
  64.     /* CSI 0 <space> p turns cursor off */
  65.  
  66.     puts("\x9b0 pPress any key to continue.");
  67.     getchar();
  68. }
  69.